﻿@model EAP.Logic.Z10.Order
@{
    ViewBag.Title = "支付订单";
    Layout = "~/Views/Shared/_Layout.cshtml";

    var customer = ViewBag.customer as Z01Beetle.Entity.Z01Customer;
    var banks = ViewBag.banks as List<Z01Beetle.Entity.Z01Bank>;
    var feeDiff = Math.Abs(Model.Z10Order.FeeShould ?? 0) - Math.Abs(Model.Z10Order.FeePaid ?? 0);
}
<script type="text/javascript">
    $(function () {
        $("#xpaysome").click(function(){
            $("#FeePaid").val("");
        });
        $("#xpayall").click(function(){
            $("#FeePaid").val("@(feeDiff.ToString("0.##"))");
        });
        $("#xsubmit").click(function () {            
            var feePaid = $("#FeePaid");

            if (feePaid.val() == "" ||  isNaN(feePaid.val())) {
                $.jvalidate(feePaid, "请填写当前支付金额！", 56);
                return false;
            }
            dPaid = parseFloat(feePaid.val());
            if (dPaid>@feeDiff){
                $.jvalidate(feePaid, "支付金额过大，请核对订单！", 56);
                return false;
            }

        });
    });
</script>
<div id="contents">
    <div id="top">
        <div class="con clearfix">
            <div class="fl">
                <a href="javascript:;" class="btn img back" rel="/Z10Order/PurchaseList"><i class="icon i_back">
                </i>返回<b></b></a>
            </div>
        </div>
    </div>
    <div id="main">
        @using (Html.BeginForm())
        { 
            <table cellspacing="0" cellpadding="0" width="100%" border="0" class="detail">
                <caption>
                    <h3 id="title">
                        支付订单(@((EAP.Logic.Z10.OrderTypes)Model.Z10Order.OrderType))</h3>
                </caption>
                <tr>
                    <td class="tt">
                        供应商：
                    </td>
                    <td class="tc">
                        @if (customer != null)
                        { 
                            <text>@customer.Title</text>
                        }
                    </td>
                    <td class="tt">
                        下单日期：
                    </td>
                    <td class="tc">
                        @(Model.Z10Order.DateOrder.HasValue ? Model.Z10Order.DateOrder.Value.ToString("yyyy年MM月dd日") : "无时间限制")
                    </td>
                    <td width="*">
                    </td>
                </tr>
                <tr>
                    <td class="tt">
                        交易币种：
                    </td>
                    <td class="tc">
                        @ViewBag.currency
                    </td>
                    <td class="tt">
                        交货日期：
                    </td>
                    <td class="tc">
                        @(Model.Z10Order.DateShip.HasValue ? Model.Z10Order.DateShip.Value.ToString("yyyy年MM月dd日") : "无时间限制")
                    </td>
                    <td width="*">
                    </td>
                </tr>
                <tr>
                    <td class="tt">
                        应支付：
                    </td>
                    <td class="tc">
                        @((Model.Z10Order.FeeShould ?? 0).ToString("0.##"))
                    </td>
                    <td class="tt">
                        备注：
                    </td>
                    <td colspan="3" class="tc">
                        @(Model.Z10Order.Remark.IsNotNullOrEmpty() ? Model.Z10Order.Remark : "")
                    </td>
                    <td width="*">
                    </td>
                </tr>
                <tr>
                    <td class="tt">
                        已支付：
                    </td>
                    <td class="tc">
                        @((Model.Z10Order.FeePaid ?? 0).ToString("0.##"))
                    </td>
                    <td width="*">
                    </td>
                </tr>
                <tr>
                    <td class="tt">
                        支出帐户：
                    </td>
                    <td class="tc" colspan="3">
                        <select id="PayAccount" name="bank">
                            @foreach (var bank in banks)
                            { 
                                <option value="@bank.BankID">@bank.Title</option>
                            }
                        </select>
                    </td>
                    <td width="*">
                    </td>
                </tr>
                <tr class="focus">
                    <td class="tt">
                        付款选项：
                    </td>
                    <td class="tc">
                        <label class="lradio">
                            <input type="radio" name="orderStatus" value="@((int)EAP.Logic.Z10.OrderStatus.PaidSome)" id="xpaysome" />
                            部分支付</label>
                        <label class="lradio">
                            <input type="radio" name="orderStatus" value="@((int)EAP.Logic.Z10.OrderStatus.Paid)" id="xpayall" checked="checked" />
                            全部支付</label>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td class="tt">
                        当前付款金额：
                    </td>
                    <td colspan="3" class="tc">
                        <input type="text" id="FeePaid" name="feePaid" class="text" value="@(feeDiff.ToString("0.##"))" />
                    </td>
                    <td width="*">
                    </td>
                </tr>
                <tr class="action">
                    <td>
                    </td>
                    <td class="tc">
                        <input type="submit" value="确认支付" id="xsubmit" class="gbutton mr20" />
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                </tr>
            </table>
        }
    </div>
</div>
